package com.idc.config.security.plugins;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SimpleUrlAuthenticationSuccessHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author Trump
 * @desc
 * @date 2019/3/29 8:58
 */
public class MyAuthenticationSuccessHandler extends SimpleUrlAuthenticationSuccessHandler {
    protected Log logger = LogFactory.getLog(getClass());

    @Override
    public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException {
        loginSuccessLog(request, authentication);
        super.onAuthenticationSuccess(request, response, authentication);
    }

    //记录登录成功日志
    private void loginSuccessLog(HttpServletRequest request, Authentication authentication) {
        //todo 记录日志
    }


}
